Hy, |
Re: how to use an adress as function parameter (bis) bool aClose( Module m ) { if (null!=m) { close(m) return true } else { } } |
Re: how to use an adress as function parameter (bis) bool aClose( Module m ) { if (null!=m) { close(m) return true } else { return false } } void aSafeClose( Module & m) { bool flag=aClose(m) if(true==flag) { m=null } } void aFunc() { Module m=edit("a full path") ... ... ... aSafeClose(m) } |
Re: how to use an adress as function parameter (bis) bgr - Wed Sep 01 10:36:35 EDT 2010
First of all, you can use pointers in DXL much like in C. Responsible for this are the perms: _k* ::(&) (_k&) // the & operator makes a pointer from a reference or a variable _k& ::(*) (_k*) // the * operator makes a reference from a pointer
int a = 4 int *ptr = &a int &aRef = a int *ptr2 = &a int *ptr3 = &aRef print (*ptr) print ptr int **ptrptr = &ptr print ptrptr print (**ptrptr)
void safeClose(Module &m) { Module x = m; if (!null x) { close m; m = null } }
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|